package cn.tedu;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class Demo04 {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入用户名：");
        String username=scan.nextLine();
        System.out.println("请输入密码：");
        String password=scan.nextLine();
       //获取连接
       try (Connection conn=DBUtils.getConn()){
           Statement s=conn.createStatement();
           //create table user(id int primary key auto_increment,username varchar(50),password varchar(50)));
           String sql="insert into user values(null,'"+username+"','"+password+"')";
           s.executeUpdate(sql);
           System.out.println("注册完成！！");
       } catch (SQLException throwables) {
            throwables.printStackTrace();
       }
    }
}
